<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var arr = [1, 1, 1, 2, 2, 3, 4, 5, 6, 3, 4, 2, 4, 1]

        function mD(arr) {
            var temp = []
            var count = 0
            arr = arr.sort(function (a, b) {
                return a - b
            })
            for (var i = 0; i < arr.length; i++) {
                if (arr[i] != arr[i + 1]) {
                    temp.push(arr[i])
                }
            }
            console.log(temp);
        }

        mD(arr);
    </script>
</head>

<body>

</body>

</html>